package com.example.test;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.widget.Button;

public class testSetting extends AppCompatActivity {

    private Button setting;
    private Button settingapn;
    private Button settingmode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_setting);

        //通过布局文件控件名设置监听事件实现功能
        setting = (Button)findViewById(R.id.btn_setting1);
        setting.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面
                startActivity(intent);
            }
        });

        settingapn = (Button)findViewById(R.id.btn_apn_setting);
        settingapn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Settings.ACTION_APN_SETTINGS);//APN
                startActivity(intent);
            }
        });

        settingmode = (Button)findViewById(R.id.btn_mode_setting);
        settingmode.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS);//更多连接方式设置界面
                startActivity(intent);
            }
        });
    }

    //通过布局文件控件设置onclick实现事件点击功能
    public void Testsetting(View view){
        Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);//添加账户界面
        startActivity(intent);
    }

    public void Testlocation(View view){
        Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);//定位设置界面
        startActivity(intent);
    }

    public void Testroaming(View view) {
        Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);//双卡和移动网络设置
        startActivity(intent);
    }
}